<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 200px;
      height: 200px;
      background-color: deeppink;
    }
  </style>
</head>

<body>
  <div></div>
  <script>
    var div = document.querySelector('div');
    div.onclick = function () {
      this.style.backgroundColor = 'skyblue';
      this.style.width = '300px';
    }
    // 注意：
    // 1. JS 里面的样式采用驼峰命名法，比如fontSize、backgroundColor
    // 2. JS 修改style样式操作，产生的是行内样式，CSS权重比较高
  </script>
</body>

</html>